package com.pactera.madp.cp.service.impl;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pactera.madp.cp.api.em.workcontact.EventEnum;
import com.pactera.madp.cp.api.entity.ContactEmployeeTrackEntity;
import com.pactera.madp.cp.mapper.ContactEmployeeTrackMapper;
import com.pactera.madp.cp.service.ContactEmployeeTrackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * ContactEmployeeTrackServiceImpl
 *
 * @author jun
 * @version 1.0
 * 2021/7/28 14:34
 **/
@Service
@Slf4j
public class ContactEmployeeTrackServiceImpl extends ServiceImpl<ContactEmployeeTrackMapper, ContactEmployeeTrackEntity> implements ContactEmployeeTrackService {

    @Override
    public void saveTrack(Integer employeeId, Integer contactId, EventEnum eventEnum, String content, Integer channel,Integer corpId) {
        ContactEmployeeTrackEntity contactEmployeeTrackEntity = new ContactEmployeeTrackEntity();
        contactEmployeeTrackEntity.setEmployeeId(employeeId);
        contactEmployeeTrackEntity.setContactId(contactId);
        contactEmployeeTrackEntity.setEvent(eventEnum.getCode());
        contactEmployeeTrackEntity.setContent(content);
        contactEmployeeTrackEntity.setChannel(channel);
        contactEmployeeTrackEntity.setCorpId(corpId);
        contactEmployeeTrackEntity.setCreateTime(DateUtil.toLocalDateTime(DateTime.now()));
        save(contactEmployeeTrackEntity);
    }

}
